#!/bin/bash

USERNAME="hqz"
PASSWORD="${DB_PASSWORD}"
SQL_FILE1="./src/main/resources/db.migration/final.sql"
SQL_FILE2="./src/main/resources/db.migration/final2.sql"
SQL_FILE3="./src/main/resources/db.migration/final3.sql"
SQL_FILE4="./src/main/resources/db.migration/final4.sql"

mysql -u $USERNAME -p$PASSWORD -e "source $SQL_FILE1;"
mysql -u $USERNAME -p$PASSWORD -e "source $SQL_FILE2;"
mysql -u $USERNAME -p$PASSWORD -e "source $SQL_FILE3;"
mysql -u $USERNAME -p$PASSWORD -e "source $SQL_FILE4;"

if [ $? -eq 0 ]; then
    echo "SQL 文件执行成功！"
else
    echo "SQL 文件执行失败！"
fi